import React,{Component} from 'react';
import './TablePanel';
import {Col, Row} from "antd";
import TablePanel from "./TablePanel";

class FamilyMember extends Component{
    constructor(props){
        super(props);
        this.state={}
    }

    render() {
        const keys=['name','sex','relate','status','wenhua','jiankang','hunyin','job','zhengzhi','shenfen','loading'];
        const labels=['姓名','性别','与户主关系','身份证号码','文化程度','健康状况','婚姻状态','职业','政治面貌','身份','是否正在接受高等教育'];
        const memberList=[
            {
                name:'1',
                sex:'1',
                relate:'1',
                status:'1',
                wenhua:'1',
                jiankang:'1',
                hunyin:'1',
                job:'1',
                zhengzhi:'1',
                shenfen:'1',
                loading:'1',
            },
            {
                name:'1',
                sex:'1',
                relate:'1',
                status:'1',
                wenhua:'1',
                jiankang:'1',
                hunyin:'1',
                job:'1',
                zhengzhi:'1',
                shenfen:'1',
                loading:'1',
            }
        ];
        return(
            <TablePanel title={'二、家庭成员信息'}>
                    {
                        this.handleGetTable(memberList,keys,labels)
                    }
            </TablePanel>
        )
    }

    handleGetTable(memberList,keys,labels){
        const tableList=[];
        for(let i=0;i<11;i++){
            tableList.push(<Row key={i+1} className={keys[i]==='status'?'tablePanelRow statusHeight':'tablePanelRow'}>
                {
                    this.handleGetCol(memberList,keys,labels,i)
                }
            </Row>);
        }
        return tableList;
    }

    handleGetCol(memberList,keys,labels,index){
        const colList=[<Col key={0} className={'tablePanelRowCol'} xs={3} sm={3} md={3} lg={3} xl={3} xxl={3}>{labels[index]}</Col>];
        const len=7-memberList.length;
        for(let i=0;i<memberList.length;i++){
            colList.push(<Col key={i+1} className={'tablePanelRowCol'} xs={3} sm={3} md={3} lg={3} xl={3} xxl={3}>{memberList[i][keys[index]]}</Col>)
        }
        for(let i=0;i<len;i++){
            colList.push(<Col key={i+memberList.length+2} className={'tablePanelRowCol'} xs={3} sm={3} md={3} lg={3} xl={3} xxl={3}>{}</Col>)
        }
        return colList;
    }
}

export default FamilyMember;
